<template>
  <div id="concourselist"> 


          <el-table :data="datalist" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">

                <el-table-column label="序号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span>{{ scope.row.sort }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="奖品名称"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span>{{ scope.row.name }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="是否特别奖品"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.special == 0">不是</span>
                        <span v-if="scope.row.special == 1">是</span>
                    </template>
                </el-table-column>
                <el-table-column :label="variable_name1 + '、' + variable_name2"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.type == 'KMB' ">{{ variable_name1 }}</span>
                        <span v-if="scope.row.type == 'GDB' ">{{ variable_name2 }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="价格"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span>{{ scope.row.price }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作"  align='center' width="150px">                   
                    <template slot-scope="scope">   
                         <el-button size="mini"  type="primary" class="button_class1"  plain @click="px_but(scope.row)">排序</el-button>                  
                         <el-button size="mini"  type="primary" class="button_class2"  plain @click="delect_but(scope.row)">删除</el-button> 
                    </template>
                </el-table-column>

  
            </el-table>  

              <!-- 排序 -->
     <el-dialog title="排序" :visible.sync="px_mtk"  width="400px">
        <div style="width:100%;"> 

           <el-form ref="form"   label-width="50px" style="width:100%;">
            
          
            <el-form-item label="排序">
                    <el-input    v-model="px_form.num" placeholder="排序"></el-input>
            </el-form-item> 


            </el-form>

            <div style="text-align: center;width:50%;margin:auto;">
                <el-button type="primary" class="custom_color_button" style="width:80%;" @click="px_but_qr()">确认</el-button>
            </div>

        </div> 

      </el-dialog>    
 
   </div>
</template>

<script>
import toolbarOptions from '@/assets/js/quillConfig.js'
export default {
   name: 'concourselist',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        px_mtk:false,
        my_id:'',
        px_form:{
            num:'',
        }
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 290
      
  },
  mounted (){
    
  },
  methods: {
   px_but(row){
      this.px_mtk = true
      this.my_id = row.pzid
      this.px_form.num = row.sort 
   },
   px_but_qr(){
       this.post("/draw_lottery/sortForPrize", {
            pzid:this.my_id,
            num:this.px_form.num
       }).then(res => {
            if(res.error_code == 0){
                    this.open1(res.result,'success')  //提示框
                    this.px_mtk = false
                    this.$emit('up_list_fun')
            }else {
                    this.open1(res.message,'warning')
            }

        })
   },
   delect_but(row){
       
       this.$confirm('是否删除此奖品, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
                this.post("/draw_lottery/deletePirze", {
                    pzid:row.pzid,
                }).then(res => {

                    if(res.error_code == 0){
                        this.open1(res.result,'success')  //提示框
                        this.$emit('up_list_fun')
                    }else {
                        this.open1(res.message,'warning')
                }

             })
        }).catch(() => {
                
        });

   }
 
  }
}
</script>


<style scoped>

</style>